<template>
    <div class="poa">
        <top @leftfn="back" :left="'el-icon-arrow-left'" :title="'设置'" />
        <div class="gun">
            <list v-if="user" @fn="user_safe" :text="'账号与安全'" :icon="'el-icon-arrow-right'" />
            <list v-if="user" @fn="user_userinfo" :text="'资料编辑'" :icon="'el-icon-arrow-right'" />
            <list :text="'清除缓存'" :right_text="'2.00kb'" />
            <list v-if="user" :text="'意见反馈'" :icon="'el-icon-arrow-right'" />
            <list :text="'关于社区'" :icon="'el-icon-arrow-right'" />
            <submit :text="'退出登录'" @yes="back_login" />
            <div class="bt"></div>
        </div>
    </div>
</template> 
<script>
import top from './common/top.vue'
import submit from './common/submit.vue'
import list from './common/list.vue'
export default ({
    components: {
        top,
        list,
        submit,
    },
    data() {
        return {
            user: false,
        }
    },
    methods: {
        back_login() {
            console.log('1')
        },
        back() {
            this.$router.go(-1)
        },
        user_userinfo() {
            this.$router.push('/user_userinfo')
        },
        user_safe() {
            this.$router.push('/user_safe')
        },
        back_login() {
            localStorage.removeItem('token')
            this.$router.push('/login')
        }
    },
    created() {
        if (localStorage.getItem('token')) {
            this.user = true
        }
    }
})
</script>
<style scoped lang="scss">
@function r($v) {
    @return $v / (390 /10rem)
}
</style>